public class Leetcode2347 {

    public String bestHand(int[] ranks, char[] suits) {
        if (suits[0] == suits[1] && suits[1] == suits[2] && suits[2] == suits[3] && suits[3] == suits[4]) {
            return "Flush";
        }

        int[] rankCount = new int[14];
        for (int rank : ranks) {
            rankCount[rank]++;
        }

        for (int i : rankCount) {
            if (i >= 3) {
                return "Three of a Kind";
            }
        }
        for (int i : rankCount) {
            if (i >= 2) {
                return "Pair";
            }
        }

        return "High Card";
    }
}
